package cn.zzdt4j.common.model;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * @author by <a href="mailto:ligang941012@gmail.com">gang.Li</a>
 * @since 2023/10/26 3:17
 */
@Data
@Accessors(chain = true)
public class Result<T> implements Serializable {

    private static final long serialVersionUID = -4408341719434417427L;

    /**
     * Correct return code.
     */
    public static final String SUCCESS_CODE = "0";

    /**
     * Return code.
     */
    private String code;

    /**
     * Message.
     */
    private String message;

    /**
     * Response data.
     */
    private T data;

    /**
     * Is success.
     *
     * @return
     */
    public boolean isSuccess() {
        return SUCCESS_CODE.equals(code);
    }
}
